//1引入express模块
const { json } = require('express');
//引入mock.js
var Mock = require('mockjs')
var express =  require('express');
// 2 创建路由对象
var router = express.Router();

router.get("/showStudentList",(req,resp)=>{

   //获得模拟数据
   let data =Mock.mock({
      'students|10': [{
         "id|+1":1,
         "name":"@cname",
         //"gender":/男|女/,
         "gender":"@string('男|女',1)",
         "age|20-30":20,
         "class":{
            "id|1-3":1,
            'name':"班级@integer(1,3)"  
         }

     }]
   });
   console.log(JSON.stringify(data))
   resp.end(JSON.stringify(data));
})

//暴露接口
module.exports=router;
